Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #344 +/- ##
=======================================
Coverage 40.02% 40.02%
=======================================
Files 45 45
Lines 4240 4240
Branches 380 380
=======================================
Hits 1697 1697
Misses 2523 2523
Partials 20 20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR addresses flaky timing-dependent tests by replacing real time delays with a deterministic clock mechanism. Instead of relying on actual wall-clock time (which can vary across machines and CI environments), the tests now use a patched time.monotonic that can be manually advanced.
Key Changes
- Added a
patched_clockpytest fixture that provides aFakeClockclass to replacetime.monotonicwith deterministic time control - Modified three test files to use the
patched_clockfixture instead oftime.sleep()for time advancement - Updated the README.rst Zenodo badge to use a DOI-specific URL
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/python/conftest.py | Adds the patched_clock fixture with a FakeClock class that provides deterministic time control for tests |
| tests/python/unit/services/test_services_usage.py | Removes time import and @flaky decorator; updates tests to use patched_clock.advance() instead of time.sleep() |
| tests/python/unit/services/test_services_base.py | Removes time import and @flaky decorator; updates test to use patched_clock.advance() instead of time.sleep() |
| tests/python/integration/test_integrated.py | Adds import for retry_module; creates fake_sleep to advance patched clock during async sleep; patches retry module's asyncio and random for deterministic behavior |
| README.rst | Updates Zenodo badge URL to include specific DOI reference |
castelao
approved these changes
Nov 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A few of our tests kept failing on GHA (and presumably other machines) because they relied on precise timings. In this PR, we remove the dependency on machine timing by patching the time module and manually advancing the clock to make sure our code behaves as expected when the time changes.